
local CheatScene = class("CheatScene", cc.load("mvc").ViewBase)

function CheatScene:onCreate()
    local uimap=FZutil.createSceneNode("test/CheatView")
    self:addChild(uimap.root)
    self.uimap=uimap
    
    uimap.Button_item:onTouch(function(e)
        if e.name=="ended" then
        	local msg={
                param=string.format("@生产 %s %d %d",uimap.TextField_itemname:getString(),
                    uimap.TextField_itemnum:getString(),uimap.TextField_packtype:getString())
        	}
            print(msg.param)
            NetEngine:sendMessage(ProtoCmd.ReqExecGMCmdMessage,msg) 
        end
    end)
    
    uimap.Button_item2:onTouch(function(e)
        if e.name=="ended" then
        	local msg={
                param=string.format("@生产2 %d %d %d",uimap.TextField_itemid:getString(),
                    uimap.TextField_itemnum2:getString(),uimap.TextField_packtype2:getString())
        	}
            print(msg.param)
            NetEngine:sendMessage(ProtoCmd.ReqExecGMCmdMessage,msg) 
        end
    end)

    uimap.Button_lv:onTouch(function(e)
        if e.name=="ended" then
        	local msg={
                param=string.format("@调整等级 %d",uimap.TextField_lv:getString())
        	}
            print(msg.param)
            NetEngine:sendMessage(ProtoCmd.ReqExecGMCmdMessage,msg,false) 
        end
    end)

    uimap.Button_lv_pack2:onTouch(function(e)
        if e.name=="ended" then
            NetEngine:sendMessage(ProtoCmd.ReqHorseUpMessage,{oType= tonumber(uimap.TextField_pack2:getString())}) 
        end
    end)
    
    uimap.Button_home:onTouch(function(e)
        if e.name=="ended" then
        	--self:getApp():enterScene("StageScene")
            MyApp:restart()
        end
    end)        
end

function CheatScene:onEnter()
    
end

function CheatScene:onExit()
    
end

return CheatScene